import request from '@/utils/request'

// 查询非遗信息列表
export function listHeritage(query) {
  return request({
    url: '/system/heritage/list',
    method: 'get',
    params: query
  })
}

// 查询非遗信息详细
export function getHeritage(heritageId) {
  return request({
    url: '/system/heritage/' + heritageId,
    method: 'get'
  })
}

// 新增非遗信息
export function addHeritage(data) {
  return request({
    url: '/system/heritage',
    method: 'post',
    data: data
  })
}

// 修改非遗信息
export function updateHeritage(data) {
  return request({
    url: '/system/heritage',
    method: 'put',
    data: data
  })
}

// 删除非遗信息
export function delHeritage(heritageId) {
  return request({
    url: '/system/heritage/' + heritageId,
    method: 'delete'
  })
}

// 上传图片
export function uploadImage(data) {
  return request({
    url: '/system/heritage/upload/image',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 上传视频
export function uploadVideo(data) {
  return request({
    url: '/system/heritage/upload/video',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 删除文件
export function deleteFile(fileUrl) {
  return request({
    url: '/system/heritage/file',
    method: 'delete',
    params: { fileUrl }
  })
} 